<!DOCTYPE html>
<html>
<head>
<#include "/admin/common/common.ftl" parse=true encoding="utf-8">
</head>
<body class="hold-transition skin-blue sidebar-mini">
	<div class="wrapper">
		<#include "/admin/common/header.ftl" parse=true encoding="utf-8">

		<!-- Content Wrapper. Contains page content -->
		<div class="content-wrapper">
			<!-- Content Header (Page header) -->
			<section class="content-header">
				<h1>课程管理</h1>
				<ol class="breadcrumb">
					<li class="active">课程列表</li>
				</ol>
			</section>

			<!-- Main content -->
			<section class="content">
				<!-- Info boxes -->
				<div class="row">
					<div class="box">
						<div class="box-header">
							<div class="table-btn">
								</a> <a href="javascript:addnew();"> <span class="label label-primary">添加新课程</span>
								</a>
							</div>
						</div>
						<!-- /.box-header -->
						<div class="box-body">
							<table id="defaultForm" class="table table-striped">
								<thead>
									<tr>
										<th>课程名称</th>
										<th>课程级别</th>
										<th>课程类别</th>
										<th>章数目</th>
										<th>节数目</th>
										<th>发布时间</th>
										<th>操作</th>
									</tr>
								</thead>
								<tbody>
									<#if list??&&(list?size>0)> <#list list as entity>
									<tr>
										<td>${entity.name!}</td>
										<td>${entity.level!}</td>
										<td>${entity.catalogName!}</td>
										<td>${entity.chapterNum!}</td>
										<td>${entity.lessonNum!}</td>
										<td>${entity.createTime!}</td>
										<td>
											<a href="javascript:detail('${entity.sn!}')"> <span class="label label-primary">课程详情</span></a>
											<a href="javascript:chapterList('${entity.id!}')"> <span class="label label-primary">章列表</span></a>
											<a href="javascript:del('${entity.id!}')"> <span class="label label-primary">删除</span></a>    
										</td>
									</tr>
									</#list> <#else>
									<tr>
										<td colspan="20">暂无记录</td>
									</tr>
									</#if>
									<!-- /.box-body -->

								</tbody>
							</table>
						</div>
						<!-- /.box-body -->

					</div>
					<#include "/admin/common/pager-auto-reload.ftl" parse=true encoding="utf-8">
				</div>
				
					<!-- /.box -->
				<!-- /.row -->
			</section>
			<!-- /.content -->
		</div>
		<!-- /.content-wrapper -->
	</div>
	<!-- ./wrapper -->
	<#include "/admin/common/footer.ftl" parse=true encoding="utf-8">
</body>

	<script type="text/javascript">
        function del(courseId){
	        bootbox.setLocale("zh_CN");
	        bootbox.confirm("您确认删除选定的记录吗？", function(result){
		        if(result){
			        var url = "${base}/admin/course/delete/" + courseId + ".do";
			        var entity = {  };
			        var onloadFunc = function(result){
				        if(result.isSuccess == true){
					        history.go(0);
				        }else{
					        bootbox.alert("删除失败！");
				        }
			        };
			        httpRequestPostJson(url, entity, false, onloadFunc);
		        }
	        });
        }

        function detail(sn){
	        window.location = '${base}/admin/course/' + sn + '/detail.do';
        }
        
        function chapterList(courseId){
	        window.location = '${base}/admin/course/' + courseId + '/chapter/list.do';
        }
        
        
        function search(){
	        window.location = "${base}/admin/member/personal/search.do";
        }
        
        function addnew(){
        	window.location = "${base}/admin/course/addnew.do";
        }
        
	</script>
</html>

